package com.numberone.web.controller.goodsImg;

import com.numberone.common.page.TableDataInfo;
import com.numberone.framework.web.base.BaseController;
import com.numberone.system.domain.GoodsImg;
import com.numberone.system.service.IGoodsImgService;
import com.numberone.system.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 商品图片 信息操作处理
 *
 * @author 郭财源
 * @date 2020-09-28
 */
@Controller
@RequestMapping("/api/GoodsImg")
public class GoodsImgApiController extends BaseController {

    @Autowired
    private IGoodsImgService goodsImgService;

    /**
     * 根据商品获取对应图片
     * @author 郭财源
     * @param goodsId
     * @return
     */
    @ResponseBody
    @PostMapping("/getGoodsImg")
    public JsonResult getGoodsImg(Long goodsId)
    {
        List<GoodsImg> goodsImgs = goodsImgService.selectGoodsImgByGoodsId(goodsId);
        TableDataInfo dataTable = getDataTable(goodsImgs);
        return JsonResult.success(dataTable);
    }
}
